
public class MenuButton implements Clickable{
	
	private String buttonName;
	private int x;
	private int y;
	private int dx;
	private int dy;
	private Menu menu;
	private boolean buttonOn;
	
	public MenuButton(String buttonName, int x, int y, int dx, int dy, Menu menu){
		this.menu = menu;
		this.buttonName = buttonName;
		this.x = x;
		this.y = y;
		this.dx = dx;
		this.dy = dy;
		buttonOn = true;
	}
	
	public void turnButtonOn(){
		buttonOn = true;
	}
	
	public void turnButtonOff(){
		buttonOn = false;
	}

	@Override
	public boolean overlaps(int x, int y) {
		if(x > this.x && x < this.x + dx && y > this.y && y < this.y + dy){
			if(buttonOn){
				menu.activate(buttonName);
				return true;
			}
		}
		return false;
	}
	
}
